package 一些算法竞赛测试题;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: a
 * Date: 2022-09-26
 * Time: 17:21
 */
public class Demo4 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        ArrayList<Integer> list1 = new ArrayList<>();
        ArrayList<Integer> list2 = new ArrayList<>();
        for(int i = 0; i < 10; i++) {
            int x = scanner.nextInt();
            if (x % 2 == 0) {
                list1.add(x);
            } else {
                list2.add(x);
            }
        }
        Collections.sort(list1);
        Collections.sort(list2);
        int size1 = list1.size();
        int size2 = list2.size();
        for(int i = size2 - 1; i >= 0; i--){
            System.out.print(list2.get(i) + " ");
        }
        for(int i = 0; i < size1; i++){
            System.out.print(list1.get(i) + " ");
        }
    }
}
